   
        <form id="filter_switch_form" name="filter_switch_form">
            <?php /*?><div style="top:10px;position:absolute;right:5px;">
                <dl class="small">
                  <dt>
                      <label>Search :</label>                                    
                  </dt>
                  <dd>
                      <?=form_input(array('name' => 'keyword',
                                         'id' 	 => 'keyword',
                                         'class' => 'inputtext w160',
                                         'value' => $keyword
                                         ))?>   
                                                   
                     <input id="submit_filter_switch" style="height:27px;" type="submit" class="submit" value="Search" />
                  </dd>
                </dl>    
            </div><?php */?>
<?php
		/*$select = '';
		$select5 = '';
		$select1 = '';
		$select2 = '';
		if($option == '25'){
			$select = 'selected="selected"';
		}elseif($option == '50'){
			$select5 = 'selected="selected"';
		}elseif($option == '100'){
			$select1 = 'selected="selected"';
		}else{
			$select2 = 'selected="selected"';
		}*/
?>
<a class="icon PDF c_pdf" rel="" >Print</a>
<table cellpadding="0" cellspacing="0" border="0" id="listTable"  class="list">
    <thead>
        <tr>
            <th axis="number" width="4%"><strong>ID</strong></th>
            <th axis="string" ><strong>Product</strong></th>
            <th axis="string"><strong>Price</strong></th>
            <th axis="string" width="3%"><strong>Description</strong></th>
            <th axis="string" width="15%"><strong>Image</strong></th>
            <th axis="string" width="15%"><strong>Option</strong></th>
        </tr>
    </thead>
    <tbody>	
       <?php foreach($products as $row):?>
           <tr>
                <td><?php echo $row['pd_id'];?></td>
                <td><?php echo $row['pd_name'];?></td>
                <td><?php echo $row['pd_price'];?></td>
                <td><?php echo $row['pd_des'];?></td>
                <td><?php echo $row['pd_image'];?></td>
                <td>
                    <a class="icon edit center edit_product" rel="<?php echo $row['pd_id'];?>" main="2" style="display:inline-block;" title="Edit"></a>&nbsp;&nbsp;|&nbsp;&nbsp;
                    <a class="icon delete center remove_product" rel="<?php echo $row['pd_id'];?>" id="" style="display:inline-block;" title="Delete"></a>
                </td>
            </tr>
		<?php endforeach;?>            
    </tbody>
</table>
<?php /*?><div style="float:right">
	<span style="float:left;margin-right:5px;">Number record view : </span>
    <span style="float:left">
        <select name="num" class="view_record" style="width:40px;">
            <option value="25" <?=$select;?>>25</option>
            <option value="50" <?=$select5;?>>50</option>
            <option value="100" <?=$select1;?>>100</option>
            <option value="200" <?=$select2;?>>200</option>
        </select>
    </span>   
</div><?php */?>
		<?= $paginations ?>
    </form> 
<script type="text/javascript">	
	/**
	 * PDF
	 *
	 */

	$$('.PDF').each(function(item)
	 {
	  item.addEvent('click', function(e)
	  {
	   e.stop();
	   var id = item.getProperty('rel');
	   ION.updateElement({
		'url':'pr_pdf/pdf/' + id
	   });
	  });
	 });
	 
	//sort table
	new SortableTable('listTable',{sortOn: 0, sortBy: 'ASC'});	
	// edit location
	$$('.edit_product').each(function(item)
	{
		item.addEvent('click', function(e)
		{
			e.stop();
			var id = item.getProperty('rel');
			//var wid = id;					// Window ID. Ex: wuser120
			ION.formWindow(
				//wid, 						// object ID
				'',
				'newProduct',// Form ID
				'Edit Product', 		// Window title
				'pr_product/page_edit_product/'+id,	// Window content URL
				{width: 350,height: 250}	// Window options
			);
		});
	});
	
	// Apply change bandwidth in / out
	$$('.remove_product').addEvent('click', function(e)
	{
		e.stop();
		var id		= this.getProperty('rel');
		var wid 	= id;			// Window ID. Ex: wuser120
		ION.confirmation(
						wid,
						'pr_product/delete_product/'+id,		
						'Do you want to remove this item ('+id+')?'						
						);
	});
	/**
	 * Pagination element link
	 *
	 */
	$$('#pagination li a').each(function(item, idx)
	{
		item.addEvent('click', function(e)
		{
			e.stop();
			
			new Request.HTML({
				url: admin_url + 'pr_product/get_list_filter/' + this.getProperty('rel') + '/<?= $nb ?>',
				method: 'post',
				loadMethod: 'xhr',
				data: $('submit_filter_switch'),
				
				//pr_product_filter is the id in pr_product_filter view
				update: $('pr_product_filter')
			}).send();
		});
	});
	//- Commun
	$('submit_filter_switch').addEvent('click', function(e)
	{	
		e.stop();	
		new Request.HTML({
			url: admin_url + 'pr_product/get_list_pagination/',
			method: 'post',
			loadMethod: 'xhr',
			data: $('filter_switch_form'),//from id
			update: $('pr_product_list'),//div id for show view list
			onRequest: function() { MUI.showSpinner();},
			onFailure: function(xhr) { MUI.hideSpinner();},
			onComplete: function() { MUI.hideSpinner();}
		}).send();				
	});
	/**
	 * view record element link
	 *
	 */
	$$('.view_record').each(function(item)
	{
      item.addEvent('change', function(e)
	  {
		  e.stop();
		  new Request.HTML({
			  url: admin_url + 'pr_product/get_list_filter/1/'+ item.get('value'),
			  method: 'post',
			  loadMethod: 'xhr',
			  data: $('filter_switch_form'),
			  update: $('pr_product_filter')
		  }).send();
	  });
	});
	MUI.get('w1').close();
</script>
